package cvi.com.reader.tool;

public class DateUtil {

    /**
     * 将毫秒数转换成"mm:ss"时间串
     */
    public static String toVideoTime(int duration) {
        String time;
        int oneSecond = 1000;
        int oneMinute = 60 * oneSecond;
        if (duration > 0)
        {
            int m = duration / oneMinute;
            int s = (duration % oneMinute) / oneSecond;
            time = (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s);
        }
        else
        {
            time = "00:00";
        }
        return time;
    }
}
